 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE HTML>
<html>
<head>
<title>乐控通行证</title>
<meta  content="text/html; charset=utf-8" http-equiv="Content-Type"  />
<link type="text/css" rel="stylesheet" href="/products/passport/v2/css/base.css"/>
<link type="text/css" rel="stylesheet" href="/products/passport/v2/css/register.css"/>
<!-- <script src="/products/passport/v2/js/detectmobilebrowser.js"></script> -->
<!--[if lte IE 6]>
<script src="/products/passport/v2/js/png.js" type="text/javascript"></script>
<script type="text/javascript">
	DD_belatedPNG.fix('div,span,img,li,a,a.logo');
</script>
<![endif]-->
<link rel="shortcut icon" href="favicon.ico"   type="image/x-icon" />
</head>

<body class="login_body"  style="min-width: 980px;">
<div id="reg_main" class="reg_main" >
  <div class="reg_main_cont"> 
    <!--头部-->
    <div class="reg_main_header login_header">
      <ul class="logotit">
        <li><img src="/products/passport/v2/img/login_logo.png" class="mr10 fleft mt20" /></li>
      </ul>
    </div>
    <!--内容-->
    <div class="login_main">
    <div class="loginleftbg" id="loginleftbg">
        <a id="loginbg2" href="index" ><img src="/products/passport/v2/img/loading.gif" gsrc="/products/passport/v2/img/loginbg2.jpg"></a>
        <a id="loginbg3" href="index" ><img src="/products/passport/v2/img/loading.gif" gsrc="/products/passport/v2/img/loginbg3.jpg"></a>
		<a id="loginbg1" href="index" ><img src="/products/passport/v2/img/loading.gif" gsrc="/products/passport/v2/img/loginbg-gw2.jpg"></a>
      </div>
      <!--登录部分-->
      <div class="loginbg">
      	<div class="login_wrapper">
        <div class="txtCenter logintit">乐控科技通行证</div>
            <div id="login_content" class="loginCon"> 
            	 <div class="tabs loginbg_tabs1" id="login_type_tabs" style="background: white"> 
                </div>
            	
                <!--提示框-->
                <div class="errorTips dnone" id="error_name"><span class="fleft"></span><div></div><b></b></div>
                <!--通用登录-->
                <div class="item1" id="CommonLogin">
                    <div class="input_text">
                      <div class="user_id fleft"><span class="userNa"></span></div>
                      <input type="text" autocomplete="off" class="fs14 fleft" maxlength="30"   id="user_id_txt" placeholder="请输入账号">
                        <div class="input_del fleft dnone" id="user_id_txt_del"></div>
                    </div>
                    <div class="input_text">
                       <div class="userPa_val" id="password_tipval"></div>
                      <div class="user_id fleft"><span class="userPa"></span></div>
                      <input type="password" autocomplete="off" oncut="return false" oncopy="return false" oncontextmenu="return false" onpaste="return false" class="fs14 fleft" maxlength="16" id="password_txt" placeholder="请输入密码">
                    </div>
                     <div id="vode_area" class="vode_area dnone" style="padding-top: 0">
	                    <div class="input_text" >
	                      <div class="user_id fleft"><span class="userNa"></span></div>
	                      <input type="input" value="请您输入下面的验证码" qautocomplete="off" id="vcode_txt">
	                    </div>
	                    <div class="verif_code">
	                      <img class="fleft" id="verif_code_img"><a class="vali_next" id="re_vcode_btn">看不清，换一张</a>
	                    </div>
                  </div>
              
					<a class="btn_10 btnLogin" name="login_btn" id="login_btn">
					
					<span><b></b><div id="loginImg" style="display: none"><img src="/products/passport/v2/img/loading-login.gif"  style="width: 40px;"></div><div id="loginWord">登陆</div></span></a>
                </div>
				
             
                
                <!--按钮和链接-->
                <div class="item3">
                    <div class="txtCenter" id="reg_link"><a href="/products/passwordback" class="login_link mr5">忘记密码</a>|<a href="/products/regist?m=toregphone" class="login_link mr5 ml5">免费注册</a></div>
                    <div id="goback" class="txtCenter dnone"><a href="#" class="login_link">返回上一步</a></div>
                </div>
              
            </div>
        </div>
      </div>
    </div>
<!--底部-->
<div class="reg_footbox">
        <p><span>COPYRIGHT&nbsp;&copy;&nbsp;1998 &ndash; 2015 KONGZHONG. ALL RIGHTS RESERVED. </span>乐控科技版权所有</p>
        <p>京ICP证020001号&nbsp;京网文[2011]0467&ndash;160号&nbsp;经营许可证编号:B2&ndash;20090197</p>
</div>
  </div>
 </div>
 <script src="/products/passport/v2/js/jquery.js"></script>
<script type="text/javascript">
    localStorage.loginNum=localStorage.loginNum||0;
	var qrclogin_timeoutid_gls = null;
	var qrclogin_exec_flag_gls = false;


	var reLoginCnt_glo = 5;
	//背景图切换效果
	var loginleftbgcount=$("#loginleftbg img").length;
	var random_bg=Math.floor(Math.random()*loginleftbgcount)+1;
	var bg='#loginbg'+random_bg;
	var img = $(bg).find('img').first();
	img.attr('src',img.attr('gsrc'));
	$(bg).show();

	var vdcode=0;//正常流程
	var useraccount;
	var cardcode;//三个密保卡坐标
	var logintype=1;//1通用 2短信 3密保卡
	var backurl ="http://localhost:8080/products/";
	var jmcode;
	(function(){
		if(backurl.indexOf('validate')==-1){
			if(backurl.indexOf('?')>-1){
				backurl+="&validate=true";
			}else{
				backurl+="?validate=true";
			}
		}
	})();
	
	function f_qrcLoginKZ(){
		KZQRCLoginHandler.login(function(data){
			if(data.logged == true){
				window.location.href = backurl;
			}else{
				if(data.errors != null && data.errors != ""){
					alert(data.errors["text"]);
					qrclogin_exec_flag_gls = false;
					clearTimeout(qrclogin_timeoutid_gls);
				}else{
					if(qrclogin_exec_flag_gls){
						qrclogin_timeoutid_gls = window.setTimeout("f_qrcLoginKZ()", 5000);
					}else{
						clearTimeout(qrclogin_timeoutid_gls);
					}
				}
			}
		});
	 }


	//登录提示
 	var loginTips={
 		showTips:function(msg){
			$("#error_name").show().find("div").eq(0).html(msg);
 		},
 		removeTips:function(obj){
 			$("#error_name").hide();
 		}
 	};
 	//登录校验
 	var login_vd={
 		account:function(str){
	      if ($.trim(str)==""||str=="请输入账号") {return "账号未填写";};
	      var regtest = new RegExp('(^[a-zA-Z0-9_-][a-zA-Z0-9_+-]{3,15}$)|(^[a-zA-Z0-9_.-]{2,20}\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*(\\.[A-Za-z]{2,5})+$)|(^13[0-9]{9}|1[58][012356789][0-9]{8}|14[57][0-9]{8}|17[0678][0-9]{8}$)','gi');
	      if(!regtest.test($.trim(str))){
	        return "账号格式有误";
	      }
	      
	      return "";
    	},
 		pwd:function(str){
	      if (str=="") {return "密码未填写";}
	      if($.trim(str).length<6){return "密码不能小于6位";}
	      return "";
    	},
	    isshowcard:function(account,callback){
			
		},
		vdcard:function(account,callback){
		
		},
		icode:function(code){
			if(code==""||code=="请您输入下面的验证码"){return "未填写验证码";}
			return "";
		}
 	};
 	var loginForm={
 	 		account:function(){
 				$("#QRCodeLogin,#vode_area,#mbkLogin,#goback").hide();
 				$("#login_type_tabs").removeClass().addClass("tabs loginbg_tabs1");
 				$("#CommonLogin,#login_type_tabs,#reg_link").show();
 				//绑定登录按钮事件
 				$("[name='login_btn']").unbind("click").bind("click",login.account);
 				logintype=1;
 				loginTips.removeTips();

 	 		},
 	 		vcode:function(){
 	 			$("#QRCodeLogin,#mbkLogin,#login_type_tabs,#CommonLogin,#reg_link").hide();
 	 			$("#vode_area,#goback").show();
 				$('#verif_code_img').attr("src", "/products/createVCode?codeType=randomCodeLogin&"+Math.random());
 				$("#vcode_txt").val(function(){return this.defaultValue;});
 				loginTips.removeTips();

 	 		},
 	    	safecard:function(){
 	    	
 	    	},
 			qrcode:function(){
 	    		$("#CommonLogin,#vode_area,#mbkLogin,#goback").hide();
 				$("#login_type_tabs").removeClass().addClass("tabs loginbg_tabs2");
 				$("#QRCodeLogin,#login_type_tabs,#reg_link").show();
 				//绑定登录按钮事件
 				
 				logintype=4;
 				loginTips.removeTips();

 	    	}
 	 	};

 	//登录
	var login={
		account:function(){
			//初始化错误提示
			loginTips.removeTips();
			//校验用户名密码
			var result=login_vd.account($("#user_id_txt").val());
			if(result!=""){
				loginTips.showTips(result);
				return false;
			}
			result=login_vd.pwd($("#password_txt").val());
			if(result!=""){
				loginTips.showTips(result);
				return false;
			}
			//判断是否需要验证码
			switch(vdcode){
				//正常流程
				case 0:{ssoLogin(false,"");}break;
				//弹出验证码
				case 1:{loginForm.vcode();vdcode=2;return false;}break;
				//校验验证码并登录
				case 2:{
					ssoLogin(true,$("#vcode_txt").val());
				}break;
				
			}
		}
	};

 	var init=function(){
    	if(localStorage.loginNum>3){
    		$('#verif_code_img').attr("src", "/products/createVCode?codeType=randomCodeLogin&"+Math.random());
	    	$("#vode_area").show();
    	}
 		//用户名输入框叉号效果
 		$("#user_id_txt_del").click(function(){$("#user_id_txt").val("").focus();$(this).hide();});
	 	//输入框获取和失去焦点效果
	 	$("#sccode_text").delegate("input","focus",function(){
	 		$(this).addClass("input_fouse");}).delegate("input","blur",function(){
	 		$(this).removeClass("input_fouse");});
	    $("#user_id_txt,#user_id_sms_txt,#vcode_txt,#sms_code_txt").focus(function(){
	        if($(this).val()==this.defaultValue){$(this).val("");}
	    }).blur(function(){
	    	var delimg;//叉号图票
	    	if($(this).attr("id")=="user_id_txt"){delimg="#user_id_txt_del";}else{delimg="#user_id_sms_txt_del";}
	        if($(this).val()==""){$(this).val(this.defaultValue);$(delimg).hide()}else{$(delimg).show();}
	    });
	    $("#password_txt").focus(function(){
	    	$("#password_tipval").html("");
	    	$("#password_txt").val("");
	    }).blur(function(){
	    	if($(this).val()==""){$("#password_tipval").html("请输入密码");}
	    });
	    $("#password_tipval").click(function(){$("#password_txt").focus()});
	    //验证码图片换一张
	    $("#re_vcode_btn").click(function(){
	    	$('#verif_code_img').attr("src", "/products/createVCode?codeType=randomCodeLogin&"+Math.random());
	    	});
		$("#verif_code_img").click(function(){
			$('#verif_code_img').attr("src", "/products/createVCode?codeType=randomCodeLogin&"+Math.random());
		})
	    //绑定登录事件
	  /*   $("[name='login_btn']").click(login.account); */
	    $("[name='login_btn']").click(function(){
	    	//初始化错误提示
			loginTips.removeTips();
			//校验用户名密码
			var result=login_vd.account($("#user_id_txt").val());
			if(result!=""){
				loginTips.showTips(result);
				return false;
			}
			result=login_vd.pwd($("#password_txt").val());
			if(result!=""){
				loginTips.showTips(result);
				return false;
			}
			if($("#vode_area").is(":visible")){
				if($("#vcode_txt").val()=="请您输入下面的验证码"||$.trim($("#vcode_txt").val())==""){
					loginTips.showTips("验证码未填写");
					return;
				}
			}
			$("#loginWord").hide();
			$("#loginImg").show();
	    	var data={"acc":$("#user_id_txt").val(),"pwd":$("#password_txt").val()};
	    	if($("#vode_area").is(":visible")){
	    		$.extend(data,{"vCode":$("#vcode_txt").val()});
	    	}
			$.ajax({
			    url: "/products/checkpwd",
			    async:true,
			    cache: false,
			    data: data,
			    dataType: "text",
			    type: "post",
			    success: function(msg){
			    	if("success"==msg){
			    		localStorage.loginNum=0;
			    		loginTips.showTips("登陆成功");
			    		$("#loginWord").show();
						$("#loginImg").hide();;
						window.location.href='${backurl}';
			    	}else if("freeze"==msg){
			     		localStorage.loginNum++;if(localStorage.loginNum>3){
			 				$('#verif_code_img').attr("src", "/products/createVCode?codeType=randomCodeLogin&"+Math.random());
			    	    	$("#vode_area").show();
			        	}
			    		loginTips.showTips("账号尚未激活");
			    		$("#loginWord").show();
						$("#loginImg").hide();
			    	}else if("error"==msg){
			     		localStorage.loginNum++;if(localStorage.loginNum>3){
			 				$('#verif_code_img').attr("src", "/products/createVCode?codeType=randomCodeLogin&"+Math.random());
			    	    	$("#vode_area").show();
			        	}
			    		loginTips.showTips("账号或密码错误");
			    		$("#loginWord").show();
						$("#loginImg").hide();
			    	}else if("codeError"==msg){
			    		localStorage.loginNum++;
			     		if(localStorage.loginNum>3){
			    	    	$("#vode_area").show();
			        	}
			     		$('#verif_code_img').attr("src", "/products/createVCode?codeType=randomCodeLogin&"+Math.random());
			     		loginTips.showTips("验证码错误");
			    		$("#loginWord").show();
						$("#loginImg").hide();
			    	}
			    }
			 });
	    });
	    //绑定返回上一步事件
	    $("#goback a").click(goback);
	     //回车登录事件
	    $("#CommonLogin").delegate("input","keydown",function(event){if(event.keyCode==13){$("#CommonLogin [name='login_btn']").click();}});
		$("#vode_area").delegate("input","keydown",function(event){if(event.keyCode==13){$("#vode_area [name='login_btn']").click();}});
  };


  init();
</script>
<div style="display:none">
	<script type="text/javascript">
	var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
	document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F1287c2225a527abe3386233dd9316f99' type='text/javascript'%3E%3C/script%3E"));
	</script>
	</div>
</body>
</html>